import { Table } from "antd";
import { useEffect, useState } from "react";
import { getAddressById } from "../../../../utils/sendRequst";
const OrderAddressBox = (props) => {
  useEffect(() => {
    getAddressById({ id: props.id }).then((res) => {
      console.log("res", res);
      let arr = res.data.map((item) => {
        item.key = item.address_id;
        return item;
      });
      setDataSource(arr);
    });
    console.log(props.id);
  }, []);
  let [dataSource, setDataSource] = useState([]);
  const columns = [
    {
      title: "收货人姓名",
      dataIndex: "address_username",
      key: "address_username",
    },
    {
      title: "邮政编号",
      dataIndex: "address_code",
      key: "address_code",
    },
    {
      title: "收货人电话",
      dataIndex: "address_phone",
      key: "address_phone",
    },
    {
      title: "收货人地址",
      dataIndex: "address_detailed",
      key: "address_detailed",
    },
  ];
  return <Table dataSource={dataSource} columns={columns} pagination={false} />;
};
export default OrderAddressBox;
